package model.commands.environment;

import java.util.List;
import model.Environment;
import model.SyntaxErrorException;
import model.commands.Command;

/**
 * Name:
 * SETSHAPE shape_index
 * 
 * Description:
 * sets the image for a given commandable object
 *
 * @author Jimmy Longley
 */
public class SetShapeCommand extends Command {
    
    @Override
    public int evaluate (Environment e) throws SyntaxErrorException {
        List<Command> arguments = getArguments();
        int shapeIndex = arguments.get(0).evaluate(e);
        e.invokeCommandableMethod(Environment.SET_SHAPE, e.getShape(shapeIndex));
        return shapeIndex;
    }

}
